package com.dabai.applicationmanager.ui.smallprogram;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;

import com.dabai.applicationmanager.R;
import com.dabai.applicationmanager.utils.OtherUtils;
import com.dabai.dbutils.dialog.MdcDialog;

/**
 * Description : Other
 *
 * @author BAI
 */
public class AddShellShortcutActivity extends Activity {

    Context context;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        context = this;

      AlertDialog alertDialog =  MdcDialog.showInputDialog2(context, "发送shell到桌面", "", "", "快捷方式名称", "shell命令", new MdcDialog.OnInputDialog2ButtonListener() {
            @Override
            public void confirm(AlertDialog dialog, String content1, String content2) {
                if (content1.isEmpty()||content2.isEmpty()){
                    return;
                }

                Intent intent = new Intent();
                intent.setClassName("com.dabai.applicationmanager", "com.dabai.applicationmanager.ui.ExecShellActivity");
                intent.putExtra("shell",content2);
                OtherUtils.addShortCut(context,content1 , R.mipmap.ic_shell, intent);

                dialog.dismiss();
            }
            @Override
            public void cancel() {

            }
        });

      alertDialog.getWindow().setWindowAnimations(com.dabai.uitools.R.style.DBAnim_Transitions_Via);
      alertDialog.setOnDismissListener(dialog -> finish());


    }
}
